package rs.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/* Classe che fornisce una connessione al database dei tag. */
public class Datasource {
	
	private String dbURI = "jdbc:postgresql:";
	private String userName = "postgres";
	private String password = "Rustico";

	public Connection getConnection(String database) {
		Connection connection = null;
		try {
		    while (connection == null) {
		    	connection = DriverManager.getConnection(dbURI + database,userName, password);
		    }
		} 
		catch(SQLException e) {
			throw new RuntimeException(e.getMessage());
		}
		return connection;
	}

}
